package com.smooth.dao.genx;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.smooth.dao.gen.bean.BizJob;
import com.smooth.dao.genx.bean.JobCatgoryRsp;

public interface GxJobCategoryMapper {
	@Select({"<script>",
		"select * from (" + 
		"	select count(1) as cnum,biz_company.category_name " + 
		"		 from biz_job LEFT JOIN biz_company on biz_job.comp_id=biz_company.id " + 
		"		 where 1=1  " + 
		"		 GROUP BY biz_company.category_name" + 
		") as m ORDER BY m.cnum desc" ,
		"</script>"
	})
	public List<JobCatgoryRsp> queryJobsCategorys();
	
	
	@Select({"<script>",
		"select biz_job.* " ,
		"from biz_job LEFT JOIN biz_company on biz_job.comp_id=biz_company.id " ,
		"where 1=1 " ,
		"<if test='categoryName != null'> and biz_company.category_name ='${categoryName}'</if>",
		"limit 0,5",
		"</script>"
	})
	public List<BizJob> queryJobsByCategory(@Param("categoryName") String categoryName);
}
